Imports System.Data.SqlClient

Public Class Connect
    Dim cnn As SqlConnection
    Public Function Connection() As Boolean
        Dim connetionString As String
        connetionString = "Data Source=" & frmmain.PCname & "\SQLEXPRESS;AttachDbFilename=" & frmmain.path & "Cinemax.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
        cnn = New SqlConnection(connetionString)
        Try
            cnn.Open()
            ' MsgBox("Connection Open ! ")
            cnn.Close()
            Return True
        Catch ex As Exception
            MsgBox("Can not open connection ! ")
            Return False
        End Try
    End Function

    Public Function Get_table(ByVal sql As String) As DataTable
        Dim dt As New DataTable
        Dim da As SqlDataAdapter
        da = New SqlDataAdapter(sql, cnn)
        da.Fill(dt)
        Return dt
    End Function

    'Public Sub New()
    '    Connection()
    'End Sub
End Class
